//
//  LXSwitchViewCell.m
//  LvXi_newVersion
//
//  Created by 诸葛孔明 on 16/8/16.
//  Copyright © 2016年 SJT. All rights reserved.
//

#import "LXSwitchViewCell.h"

@implementation LXSwitchViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        UISwitch * sw = [[UISwitch alloc] init];
        [sw addTarget:self action:@selector(swClick:) forControlEvents:UIControlEventValueChanged];
        self.accessoryView = sw;
        UIImageView * imgv = [[UIImageView alloc] initWithImage:[UIImage imageWithColor:[UIColor whiteColor] size:CGSizeMake(ScreenWidth-2*globalMargin, 50)]];
        imgv.frame = CGRectMake(globalMargin, 0, ScreenWidth-2*globalMargin, 50);
        [imgv addRadius:10];
        self.sw = sw;
        [self.contentView insertSubview:imgv atIndex:0];
    }
    return self;
}
-(void)swClick:(UISwitch*)sw{
    [[IQKeyboardManager sharedManager] resignFirstResponder];
    if (self.handleCallBack) {
        self.handleCallBack(self);
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {

}

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
    
}

@end
